<?php
include('./init.php');
if(empty($_FILES) === false) {
	$upload = new Upload();
	$img_path = get_path(UPLOAD_PATH,date("Ymd"));
	$img_file_path = UPLOAD_PATH . "/" . $img_path;
	$r = $upload->doUpload($img_file_path,'filedata','','');
	$webimg_file_info = $img_file_path . $upload->_file_name . "." . $upload->_file_ext;
	$webimg_url = UPLOAD_URL.'/'.$img_path.$upload->_file_name . "." . $upload->_file_ext;
	if(!empty($upload->_error)) {
		echo json_encode(array('err' => $upload->_error, 'msg' => $msg));
		exit;
	}
	$image = new Image();
	$s = $image->makeThumb($webimg_file_info,$webimg_file_info,$to_wh=array(487,329));
	echo json_encode(array('err' => '', 'msg' => $webimg_url));
	exit;
}
$msg = '真爱自由，远离黑客';
echo json_encode(array('err' => 1, 'msg' => $msg));
exit;

?>